<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0px;
            padding: 0px;
        }
        #res {
            width: 600px;
            height: 600px;
            border-radius: 50%;
            border: 3px solid red;
            margin: 0px auto;
            position: relative;
        }
        .center {
            width: 20px;
            height: 20px;
            border-radius: 50%;
            border: 5px solid blue;
            background-color: #fff;
            position: absolute;
            top: 300px;
            left: 300px;
            z-index: 1;
            transform: translate(-50%,-50%);
        }
        #seconds {
            height: 280px;
            width: 10px;
            background-color: rgb(187, 231, 27);
            position: absolute;
            left: 295px;
            top: 20px;
            border-radius: 10px;
            transform-origin: center bottom;
            /* transform: rotate(30deg); */
        }
        #minutes {
            height: 260px;
            width: 18px;
            background-color: rgb(67, 220, 240);
            position: absolute;
            left: 291px;
            top: 40px;
            border-radius: 10px;
            transform-origin: center bottom;
            /* transform: rotate(30deg); */
        }
        #hours {
            height: 240px;
            width: 24px;
            border-radius: 10px;
            background-color: rgb(206, 87, 180);
            position: absolute;
            left: 288px;
            top: 60px;
            transform-origin: center bottom;
            /* transform: rotate(30deg); */
        }
    </style>
</head>
<body>
    <div id="res">
        <div class="center">
        </div>
        <div id="seconds">

        </div>
        <div id="minutes">

        </div>
        <div id="hours">

        </div>
    </div>
    <script>
        function timeOut ( ) {
            var time = new Date();              //获取当前时间
            var year = time.getFullYear();      //获取这个时间的年份
            var month = time.getMonth() + 1 ;        //获取这个时间的月份，但是是从0-11，所以打印时需要加一操作
            var date = time.getDate();          //获取这个时间的日期
            var hours = time.getHours();        //获取这个时间的小时
            var minutes = time.getMinutes();    //获取这个时间的分钟
            var seconds = time.getSeconds();    //获取这个时间的秒钟
            var arr = [hours,minutes,seconds]
            return arr ; 
        }
        function clock () {
            var secDeg = timeOut()[2] * 6 ;
            var minDeg = timeOut()[1] * 6 + timeOut()[2] / 60 * 6 ; 
            var hourDeg = timeOut()[0] * 6 + timeOut()[1] / 60 * 6 + timeOut()[2] / 3600 * 6 ;
            secondsEle.style.transform = `rotate(${secDeg}deg)`;
            minutesEle.style.transform = `rotate(${minDeg}deg)`;
            hoursEle.style.transform = `rotate(${hourDeg}deg)`;
        }
        var secondsEle = document.getElementById("seconds");
        var minutesEle = document.getElementById("minutes");
        var hoursEle = document.getElementById("hours");
        clock () ;
        setInterval(function(){
            clock () ;
        } , 500 ) ;
    </script>
</body>
</html>